## This software is licensed by the MIT License, see LICENSE file ##
##                                    Copyright © 2022 whitemangl ##

from typing import Union
from typing import List

from aiogram.types import InlineKeyboardButton
from aiogram.types import InlineKeyboardMarkup

class ConfirmationKeyboard(InlineKeyboardMarkup):

    def __init__(self, additional_buttons: Union[InlineKeyboardMarkup, List[InlineKeyboardMarkup], None] = None):

        confirm_btn = [ InlineKeyboardButton(text = "Подтвердить публикацию", callback_data = "confirm") ]
        cancel_btn  = [ InlineKeyboardButton(text = "Отменить публикацию",    callback_data = "cancel") ]

        if (isinstance(additional_buttons, InlineKeyboardMarkup)):
            additional_buttons = [additional_buttons]

        buttons = [confirm_btn, cancel_btn]
        if additional_buttons is not None:
            buttons.extend(additional_buttons)

        super().__init__(inline_keyboard=buttons)
